package org.ucas.kgraph.utils.exception;

import org.springframework.http.HttpStatus;
import org.ucas.kgraph.utils.constants.ErrCode;

/**
 * 自定义异常的父类,方便处理异常
 *
 * @author suemi
 */
public class RestException extends RuntimeException {
  private static final long serialVersionUID = 1L;

  public final ErrCode errCode;

  public RestException(ErrCode errCode) {
    super(errCode.getMessage());
    this.errCode = errCode;
  }

  public HttpStatus getHttpStatus() {
    return errCode.getStatus();
  }

  public ErrCode getErrCode() {
    return errCode;
  }
}
